package magicboard.geometry.algorithms
{
  import flash.geom.Point;
  
  import flexunit.framework.TestCase;
  import flexunit.framework.TestSuite;
  
  import magicboard.geometry.algorithms.DPPolylineSimplification;
  
  public class DPTestCase extends TestCase
  {
    // --------------------------------------------------------------------------------------------	
    public function DPTestCase(methodName:String) {
   	 super( methodName );
    }

    // --------------------------------------------------------------------------------------------	
    public static function suite():TestSuite {
   			var ts:TestSuite = new TestSuite();
   			
   			ts.addTest( new DPTestCase( "testPoints0" ) );
   			ts.addTest( new DPTestCase( "testPoints1" ) );
   			ts.addTest( new DPTestCase( "testPoints2" ) );
   			return ts;
   		}

  
    // --------------------------------------------------------------------------------------------
		public function testPoints0():void {

			var dp:DPPolylineSimplification = new DPPolylineSimplification();
			var points:Array = new Array();
			 			
 			assertNotNull(dp.simplify(points));
 		}
  		
    // --------------------------------------------------------------------------------------------
		public function testPoints1():void {

			var dp:DPPolylineSimplification = new DPPolylineSimplification();
			var points:Array = new Array();
			var simplified:Array;
			 			
			points.push(new Point(1,1));
			simplified = dp.simplify(points); 
		
 			assertNotNull(simplified);
 			assertEquals(1, simplified.length );
 		}
  		
    // --------------------------------------------------------------------------------------------
		public function testPoints2():void {

			var dp:DPPolylineSimplification = new DPPolylineSimplification();
			var points:Array = new Array();
			var simplified:Array;
			 			
			points.push(new Point(1,1));
			points.push(new Point(100,120));
			points.push(new Point(20,130));
			simplified = dp.simplify(points); 
		
 			assertNotNull(simplified);
 			assertEquals(3, simplified.length );
 		}
  		
 	}
}